<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>quick-cocos2d-x API Documents - framework.client.device</title>
<link rel="stylesheet" href="luadocx-style.css" type="text/css" />
<link rel="stylesheet" href="luadocx-style-monokai.css" type="text/css" />
<script src="luadocx-highlight.min.js"></script>
<script type="text/javascript" charset="utf-8">hljs.initHighlightingOnLoad();</script>
</head>
<body>
  <div id="container">

    <table id="main">
      <tr>
        <td id="navigation">

          <h2>Links</h2>
          <ul>
            <li><a href="index.html">Index</a></li>
          </ul>

          <h2>Modules</h2>
          <ul>
            <li><a href="index.html">framework.init</a></li>
            <li><a href="framework.client.api.context.html">framework.client.api.Context</a></li>
            <li><a href="framework.client.api.eventprotocol.html">framework.client.api.EventProtocol</a></li>
            <li><a href="framework.client.api.gamenetwork.html">framework.client.api.GameNetwork</a></li>
            <li><a href="framework.client.api.gamestate.html">framework.client.api.GameState</a></li>
            <li><a href="framework.client.api.localize.html">framework.client.api.Localize</a></li>
            <li><a href="framework.client.api.store.html">framework.client.api.Store</a></li>
            <li><a href="framework.client.api.timer.html">framework.client.api.Timer</a></li>
            <li><a href="framework.client.api.gamenetwork.openfeint.html">framework.client.api.gamenetwork.OpenFeint</a></li>
            <li><a href="framework.client.audio.html">framework.client.audio</a></li>
            <li><a href="framework.client.crypto.html">framework.client.crypto</a></li>
            <li><strong>framework.client.device</strong></li>
            <li><a href="framework.client.display.html">framework.client.display</a></li>
            <li><a href="framework.client.init.html">framework.client.init</a></li>
            <li><a href="framework.client.luaj.html">framework.client.luaj</a></li>
            <li><a href="framework.client.luaoc.html">framework.client.luaoc</a></li>
            <li><a href="framework.client.network.html">framework.client.network</a></li>
            <li><a href="framework.client.scheduler.html">framework.client.scheduler</a></li>
            <li><a href="framework.client.transition.html">framework.client.transition</a></li>
            <li><a href="framework.client.ui.html">framework.client.ui</a></li>
            <li><a href="framework.server.mysqleasy.html">framework.server.MysqlEasy</a></li>
            <li><a href="framework.server.rediseasy.html">framework.server.RedisEasy</a></li>
            <li><a href="framework.server.serveraction.html">framework.server.ServerAction</a></li>
            <li><a href="framework.server.serverapp.html">framework.server.ServerApp</a></li>
            <li><a href="framework.server.session.html">framework.server.Session</a></li>
            <li><a href="framework.server.init.html">framework.server.init</a></li>
            <li><a href="framework.shared.modelbase.html">framework.shared.ModelBase</a></li>
            <li><a href="framework.shared.debug.html">framework.shared.debug</a></li>
            <li><a href="framework.shared.errors.html">framework.shared.errors</a></li>
            <li><a href="framework.shared.functions.html">framework.shared.functions</a></li>
          </ul>

        </td> <!-- navigation -->

        <td id="content">

          <h1>Module <code>framework.client.device</code></h1>

          <!-- BEGIN module doc -->

          <div id="module_doc">

<p>Query information about the system (get device information, current language, etc) and execute system functions (show alert view, show input box, etc).</p>

<p><br /></p>

<p>Following properties predefined:</p>

<ul>
<li><p><strong>device.platform</strong> the platform name (the OS name), i.e. one of the following: ios, android, blackberry, mac, windows, linux.</p></li>
<li><p><strong>device.environment</strong> returns the environment that the app is running in. i.e. one of the following: simulator, device.</p></li>
<li><p><strong>device.model</strong> returns the device model (as specified by the manufacturer) :</p>

<ul>
<li>On iOS: return iPhone, iPad</li>
<li>On Android: return Android device model name</li>
<li>On Mac, windows, linux: return "unknown"</li>
</ul></li>
<li><p><strong>device.language</strong> returns the default language on the device :</p>

<table>
<thead>
<tr>
  <th>Value</th>
  <th>Language</th>
</tr>
</thead>
<tbody>
<tr>
  <td>cn</td>
  <td>Chinese</td>
</tr>
<tr>
  <td>fr</td>
  <td>French</td>
</tr>
<tr>
  <td>it</td>
  <td>Italian</td>
</tr>
<tr>
  <td>gr</td>
  <td>German</td>
</tr>
<tr>
  <td>sp</td>
  <td>Spanish</td>
</tr>
<tr>
  <td>ru</td>
  <td>Russian</td>
</tr>
<tr>
  <td>jp</td>
  <td>Japanese</td>
</tr>
<tr>
  <td>en</td>
  <td>English</td>
</tr>
</tbody>
</table></li>
<li><p><strong>device.writeablePath</strong> returns the writeable path.</p></li>
</ul>

<br />


          </div>

          <!-- END module doc -->


          <!--  BEGIN functions index -->

          <h2>Functions</h2>
          <table class="function_list">


            <tr>
              <td class="name" nowrap><a href="#anchor_device_showActivityIndicator">device.showActivityIndicator&nbsp;()</a></td>
              <td class="summary">Displays a platform-specific activity indicator.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_device_hideActivityIndicator">device.hideActivityIndicator&nbsp;()</a></td>
              <td class="summary">Hides activity indicator.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_device_showAlert">device.showAlert&nbsp;(title,&nbsp;message,&nbsp;buttonLabels,&nbsp;listener)</a></td>
              <td class="summary">Displays a popup alert box with one or more buttons. Program activity, including animation, will continue in the background, but all other user interactivity will be blocked until the user selects a button or cancels the dialog.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_device_cancelAlert">device.cancelAlert&nbsp;()</a></td>
              <td class="summary">Dismisses an alert box programmatically.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_device_getOpenUDID">device.getOpenUDID&nbsp;()</a></td>
              <td class="summary">Returns OpenUDID for device.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_device_openURL">device.openURL&nbsp;(url)</a></td>
              <td class="summary">Open a web page in the browser; create an email; or call a phone number.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_device_showInputBox">device.showInputBox&nbsp;(title,&nbsp;message,&nbsp;defaultValue)</a></td>
              <td class="summary">Displays a popup input dialog with ok and cancel button.</td>
            </tr>


          </table>

          <!--  END functions index -->

          <br />
          <br />

          <!-- BEGIN functions details -->

          <h2>Functions</h2>
          <dl class="function">


            <dt class="">
              <a name="anchor_device_showActivityIndicator"></a>
              <h3>device.showActivityIndicator ()</h3>
            </dt>

            <dd class="">

<p>Displays a platform-specific activity indicator.</p>

<h3>Note:</h3>

<p>Supported platform: ios, android.</p>

            </dd>


            <dt class="">
              <a name="anchor_device_hideActivityIndicator"></a>
              <h3>device.hideActivityIndicator ()</h3>
            </dt>

            <dd class="">

<p>Hides activity indicator.</p>

<h3>Note:</h3>

<p>Supported platform: ios, android.</p>

            </dd>


            <dt class="">
              <a name="anchor_device_showAlert"></a>
              <h3>device.showAlert (title, message, buttonLabels, listener)</h3>
            </dt>

            <dd class="">

<p>Displays a popup alert box with one or more buttons. Program activity, including animation, will continue in the background, but all other user interactivity will be blocked until the user selects a button or cancels the dialog.</p>

<h3>Paramters:</h3>

<ul>
<li><p>string <strong>title</strong> The title string displayed in the alert</p></li>
<li><p>string <strong>message</strong> Message string displayed in the alert text.</p></li>
<li><p>table <strong>buttonLabels</strong> Table of strings, each of which will create a button with the corresponding label.</p></li>
<li><p>function <strong>listener</strong> The listener to be notified when a user presses any button in the alert box.</p></li>
</ul>

<h3>Note:</h3>

<p>Supported platform: ios, android, mac.</p>

            </dd>


            <dt class="">
              <a name="anchor_device_cancelAlert"></a>
              <h3>device.cancelAlert ()</h3>
            </dt>

            <dd class="">

<p>Dismisses an alert box programmatically.</p>

<p>For example, you may wish to have a popup alert that automatically disappears after ten seconds even if the user doesn’t click it. In that case, you could call this function at the end of a ten-second timer.</p>

<h3>Note:</h3>

<p>Supported platform: ios, android, mac.</p>

            </dd>


            <dt class="">
              <a name="anchor_device_getOpenUDID"></a>
              <h3>device.getOpenUDID ()</h3>
            </dt>

            <dd class="">

<p>Returns OpenUDID for device.</p>

<blockquote>
  <p>OpenUDID is a drop-in replacement for the deprecated uniqueIdentifier property of the UIDevice class on iOS (a.k.a. UDID) and otherwise is an industry-friendly equivalent for iOS and Android.</p>
</blockquote>

<h3>Returns:</h3>

<ul>
<li>string OpenUDID</li>
</ul>

<h3>Note:</h3>

<p>Supported platform: ios, android, mac.</p>

            </dd>


            <dt class="">
              <a name="anchor_device_openURL"></a>
              <h3>device.openURL (url)</h3>
            </dt>

            <dd class="">

<p>Open a web page in the browser; create an email; or call a phone number.</p>

<p>Note: Executing this function will make the app background and switch to the built-in browser, email or phone app.</p>

<h3>Parameters:</h3>

<ul>
<li><p>string <strong>url</strong> url can be one of the following:</p>

<ul>
<li><p>Web link: "http://dualface.github.com/quick-cocos2d-x/"</p></li>
<li><p>Email address: "mailto:nobody@mycompany.com".</p>

<p>The email address url can also contain subject and body parameters, both of which must be url encoded.<br />
Example: "mailto:nobody@mycompany.com?subject=Hi%20there&amp;body=I%20just%20wanted%20to%20say%2C%20Hi!"<br />
Try this URL encoder to encode your text.</p></li>
<li><p>Phone number: "tel:123-456-7890"</p></li>
</ul></li>
</ul>

<h3>Note:</h3>

<p>Supported platform: ios, android.</p>

            </dd>


            <dt class="">
              <a name="anchor_device_showInputBox"></a>
              <h3>device.showInputBox (title, message, defaultValue)</h3>
            </dt>

            <dd class="">

<p>Displays a popup input dialog with ok and cancel button.</p>

<h3>Parameters:</h3>

<ul>
<li>string <strong>title</strong> The title string displayed in the input dialog</li>
<li>string <strong>message</strong> Message string displayed in the input dialog</li>
<li>string <strong>defaultValue</strong> Displayed in the text box.</li>
</ul>

<h3>Returns:</h3>

<ul>
<li>string User entered text. If uesr cancel input dialog, return nil.</li>
</ul>

<h3>Note:</h3>

<p>Supported platform: mac, windows.</p>

            </dd>


          </dl>

          <!-- BEGIN functions details -->


      </td> <!-- id="content" -->

      </tr>
    </table> <!-- id="main" -->

    <div id="about">
      <i>update: 2013-05-08 09:30:25, generated by <a href="http://github.com/dualface/luadocx">luadocx 1.1</a></i>
    </div> <!-- id="about" -->

  </div> <!-- id="container" -->

</body>
</html>
